× Lesson 1 Lesson 2 Lesson 3 Lesson 4 Lesson 5 Lesson 6 Lesson 7 Lesson 8 Lesson 9 Lesson 10 Lesson 11 Lesson 12 Lesson 13 Lesson 14 Lesson 15 Lesson 16

All lessons

Lesson 10 - For Loops

For loops are a very significant concept in Python, and will be used throughout your Python programming career. For now, we will keep the for loops very simple.

The basic syntax for a for loop is, for (any letter/word that you want) in (a list): print(the letter/word that you want)

The concept behind a for loop is that it will start at the beginning of a list, interact with that specific index, the index is the position in a list, and starts at 0 rather than 1, such as printing it out, and moving on to the next index in the list until the for loop has gone through every index in the list, it will stop

You can try out the for loop for yourself, such as by looping through [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] and outputting each number when it is being looped through.